import React, {useEffect, useState} from 'react';
import {Space, Typography} from 'antd'
import {FormOutlined} from '@ant-design/icons'
import style from './Logo.module.scss'
import {NavLink} from "react-router-dom";
import {MANAGE_INDEX_PATHNAME} from "../constants";
import useGetUserInfo from "../hooks/useGetUserInfo";

const {Title} = Typography
const Logo: React.FC = () => {
    const {username} = useGetUserInfo()
    const [pathname, setPathname] = useState('/');
    useEffect(() => {
        if (username) {
            setPathname(MANAGE_INDEX_PATHNAME)
        }
    }, [pathname]);

    return (
        <div className={style.container}>
            <Space>
                <Title>
                    <FormOutlined/>
                </Title>
                <Title>
                    <NavLink to={pathname}>
                        小慕问卷
                    </NavLink>
                </Title>
            </Space>
        </div>

    );
};

export default Logo;
